# $Id: PKGBUILD 81462 2012-12-21 10:43:48Z fyan $
# Maintainer : Felix Yan <felixonmars@gmail.com>
# Contributor: speps <speps at aur dot archlinux dot org>
# Contributor: Arnau Sanchez <tokland {at} gmail {dot} com>

_name=pyquery
pkgbase=python-pyquery
pkgname=('python-pyquery' 'python2-pyquery')
pkgver=1.2.4
pkgrel=1
pkgdesc="A jquery-like library for python."
arch=('any')
url="http://www.bitbucket.org/olauzanne/pyquery"
license=('custom:BSD')
makedepends=('python-distribute' 'python2-distribute' 'python-lxml' 'python2-lxml' 'python-cssselect' 'python2-cssselect')
source=("http://pypi.python.org/packages/source/p/$_name/$_name-$pkgver.tar.gz"
        "https://bitbucket.org/olauzanne/pyquery/raw/b70710332032/LICENSE.txt")
 
build() {
  cd "$srcdir"
  cp -r "$_name-$pkgver" "$_name-$pkgver-python2"

  cd "$srcdir/$_name-$pkgver"
  python3 setup.py build

  cd "$srcdir/$_name-$pkgver-python2"
  python2 setup.py build
}

package_python-pyquery() {
  depends=('python-lxml' 'python-cssselect')
  cd "$srcdir/$_name-$pkgver"
  python3 setup.py install --root="$pkgdir/"

  install -Dm644 ../LICENSE.txt "$pkgdir/usr/share/licenses/python-pyquery/LICENSE"
}

package_python2-pyquery() {
  depends=('python2-lxml' 'python2-cssselect')
  cd "$srcdir/$_name-$pkgver-python2"
  python2 setup.py install --root="$pkgdir/"

  install -Dm644 ../LICENSE.txt "$pkgdir/usr/share/licenses/python2-pyquery/LICENSE"
}

md5sums=('268f08258738d21bc1920d7522f2a63b'
         '4f88ad79969b924fb6038be3de456dee')
